package com.gonsin.gview.example;


import com.gonsin.gview.annotations.GViewScan;
import com.gonsin.gview.logic.EnableGView;
import com.gonsin.gview.logic.GViewEnvironment;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.socket.config.annotation.EnableWebSocket;


@ComponentScan({
        // 解决 TypeNameExtractor 找不到的问题
        "springfox.documentation.schema",
        "com.gonsin.gview",
        "com.gonsin.gview.example"
})
@SpringBootApplication
@EntityScan(basePackages = "com.gonsin.gview.example")
@EnableAutoConfiguration(exclude = {
        org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})
@GViewScan
@EnableGView
public class Application extends SpringBootServletInitializer {

    static {
        System.setProperty("hibernate.dialect.storage_engine","innodb");
    }

    public static void main(String[] args) {
        GViewEnvironment.LOG = true;
        SpringApplication.run(Application.class);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(Application.class);
    }

}

